-- background: 2725 from stack: in -- bmap block id: 3199 -- flags: 4000 -- background id: 0 -- name: intro ----- HyperTalk script ----- on buildList -- ••• rename to buildList1 if using sequential questions -- or to buildList if using randomly-generated questions global questlist,rightone,lockkey,questans,questkey global sky1, sky2, sky3, sky4, sky5, sky6 -- used for saved ans key -- initialization set the cursor to 4 -- •••questgrp contains the number of questions in each question group -- and is used to generate random questions, one from each group. -- Note that the question groups MUST BE sequential in order for this -- to work. That is, group 1 must be the first 10 questions, group 2 -- must be the next 14 questions, and so on. put "11,11,11,11,11,18,11,12,11,11," into questgrp put "11,15,11,11,16,11,11,11,14,11," after questgrp put "11,11,11,11,11" after questgrp -- ••• The number of commas in questans and questkey must be equal to -- number of questions in each test minus one. For example, for a -- 30-question test, there are 29 commas. put ",,,,,,,,,,,,,,,,,,,,,,,," into questans put ",,,,,,,,,,,,,,,,,,,,,,,," into questkey put empty into questlist put 0 into startgroup put empty into sky1 put empty into sky2 put empty into sky3 put empty into sky4 put empty into sky5 put empty into sky6 set lockscreen to true -- generate the questions from subgroups randomly repeat with i = 1 to number of items of questgrp put startgroup into thisquest add the random of item i of questgrp to thisquest put questlist & "#" & thisquest & "," into questlist add item i of questgrp to startgroup end repeat delete last character of questlist -- ••• generate the answer key for these questions. this currently -- only handles up to first 51 questions. repeat with i = 1 to number of items of questlist if i > 51 then exit repeat put item i of questlist into thisquest go to card thisquest -- ••• You can put the card # or the subelement # or question # -- as question #in key put "#" & i into x -- question # option -- put the short name of this card into x -- card # option -- put first word of field "Q1" into x -- subelement # option put first word of field "Q1" into y -- used for answer key if i < 18 then put sky1&x&"("&y&")"&return into sky1 put sky2&rightone&return into sky2 else if i < 35 then put sky3&x&"("&y&")"&return into sky3 put sky4&rightone&return into sky4 else put sky5&x&"("&y&")"&return into sky5 put sky6&rightone&return into sky6 end if end repeat go to card savedscores put sky1 into field key1 put sky2 into field key2 put sky3 into field key3 put sky4 into field key4 put sky5 into field key5 put sky6 into field key6 -- prevent buildList from being called again immediately put true into lockkey go to first card set lockscreen to false end buildList on buildList1 -- ••• rename to buildList for sequential questions or to -- buildList1 for randomly-generated questions global questlist,rightone,lockkey,questans,questkey global sky1, sky2, sky3, sky4, sky5, sky6 -- used for saved ans key -- initialization set the cursor to 4 -- ••• be sure that the group number of each question card matches the -- question number. For example, question #1 is group 1, question -- #2 is group 2, and so on. put empty into questlist put empty into questans put empty into questkey put empty into sky1 put empty into sky2 put empty into sky3 put empty into sky4 put empty into sky5 put empty into sky6 set lockscreen to true repeat with i = 1 to number of cards of bkgnd Test put "#" & i & "," after questlist put "," after questans put "," after questkey end repeat delete last character of questlist delete last character of questans delete last character of questkey -- ••• generate the answer key for these questions. This currently -- only works for first 32 questions repeat with i = 1 to number of items of questlist if i > 51 then exit repeat put item i of questlist into thisquest go to card thisquest -- ••• You can put the card # or the subelement # or question # -- as question #in key -- put "#" & i into x -- question # option put the short name of this card into x -- card # option -- put first word of field "Q1" into x -- subelement # option put first word of field "Q1" into y -- used for answer key if i < 18 then put sky1&x&"("&y&")"&return into sky1 put sky2&rightone&return into sky2 else if i < 35 then put sky3&x&"("&y&")"&return into sky3 put sky4&rightone&return into sky4 else put sky5&x&"("&y&")"&return into sky5 put sky6&rightone&return into sky6 end if end repeat go to card savedscores put sky1 into field key1 put sky2 into field key2 put sky3 into field key3 put sky4 into field key4 put sky5 into field key5 put sky6 into field key6 -- prevent buildList from being called again immediately put true into lockkey go to first card set lockscreen to false end buildList1 -- part 1 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=111 top=169 right=309 bottom=228 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Exam ----- HyperTalk script ----- on mouseDown ask "Please enter your name." put it into field "user" of card report -- ••• change unlimited to # minutes to put a time limit on test -- be sure to change background of questions and below also. answer "You have unlimited minutes to take this test" with "OK" end mouseDown on mouseUp global time1,score,check2,ok,questlist set the cursor to 4 put empty into ok put empty into score put empty into check2 put empty into field QMissed of card report get the long time put it into field "Start" of Card "Report" convert it to seconds -- ••• change 30 in next line to # of minutes desired for time limit add 30*60 to it put it into time1 -- put questlist into message -- for debug only visual effect dissolve to black visual effect dissolve -- go card "#1" -- for debug only get item 1 of questlist go card it end mouseUp -- part 2 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=27 top=47 right=85 bottom=71 -- title width / last selected line: 0 -- icon id / first selected line: 1011 / 1011 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Home ----- HyperTalk script ----- on mouseUp visual effect iris close go home end mouseUp -- part 4 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=431 top=55 right=94 bottom=472 -- title width / last selected line: 0 -- icon id / first selected line: 14767 / 14767 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Tell Me About... ----- HyperTalk script ----- on mouseUp push this card visual effect iris open go to card "About...." end mouseUp